#coding=utf-8
#此脚本全部为函数，方便直接调用进行自动化测试
from selenium import webdriver
import time, datetime
import os
import sys
from selenium.webdriver.support.select import Select
from selenium.webdriver.common.keys import Keys


#发车易贷
def op_che(adminname, password, borrowtitle, money, huankuanfangshi, rate, username_type, borrowname, month, cashgroup, agentname, rewardstate, rewardmode, reward):
    # 定义浏览器及地址
    reload(sys)
    sys.setdefaultencoding('utf-8')
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(8)
    driver.get("http://op.yidaip2p.net/")
    #进行登录co环境的运营平台
    driver.find_element_by_id("adminname").send_keys(adminname)
    driver.find_element_by_id("password").send_keys(password)
    driver.find_element_by_id("authCode").send_keys(u"123456")
    driver.find_element_by_xpath(".//*[@id='submitFrom']/ul/li[4]/input").click()
    #判断是否登录成功，并输出至日志登录账号名称
    try:
        driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em")
        a = True
    except:
        a = False
    if a == True:
        username = driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em").text
        #进入发标页面
        driver.find_element_by_xpath(".//*[@id='header']/section[2]/nav/ul/li[8]/a").click()
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[2]/a").click()
        #发标页面第一页
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[1]/aside/label[1]/input").click()
        now = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))  # 标的编号命名格式
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[2]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[3]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[4]/aside/input").send_keys(borrowtitle+ now)
        Select(driver.find_element_by_id("username_type")).select_by_visible_text(username_type)
        driver.find_element_by_id("username").send_keys(borrowname)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[5]/h6").click()
        if username_type == u"机构":
            driver.find_element_by_id("weituo_ren").send_keys(u"陈强270496")
            driver.find_element_by_id("wtUpload").send_keys("D:\\photo\\1.jpg")
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label[" + huankuanfangshi + "]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_link_text(u"下一步").click()
            #driver.find_element_by_xpath(".//*[@id='form1']/ul/li[6]/aside/input").send_keys(u"陈强")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            driver.find_element_by_link_text(u"下一步").click()
        if username_type == u"个人":
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label[" + huankuanfangshi + "]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_link_text(u"下一步").click()
            # 第二个页面
            Select(driver.find_element_by_id("edu")).select_by_visible_text(u"本科")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[6]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[7]/aside/input").send_keys(u"四川省南充市")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[8]/aside/input").send_keys(u"四川省成都市青羊区")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            Select(driver.find_element_by_id("province")).select_by_visible_text(u"四川省")
            Select(driver.find_element_by_id("city")).select_by_visible_text(u"成都")
            driver.find_element_by_id("work_info").send_keys(u"工作很好，工资很高")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[3]/li[7]/aside/span[1]/a").click()
        # 编辑发标的第三个页面
        driver.find_element_by_xpath(".//*[@id='car']/li[2]/aside/label[1]/input").click()
        driver.find_element_by_xpath(".//*[@id='car']/li[3]/aside/label[1]/input").click()
        driver.find_element_by_xpath(".//*[@id='car']/li[7]/aside/input").send_keys(u"100")
        driver.find_element_by_xpath(".//*[@id='car']/li[12]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[6]/li/aside/input[3]").click()
        # 进入发标第四个页面,并判断是否有奖励标
        driver.find_element_by_xpath(".//*[@id='house']/li[2]/aside/label[" + rewardstate + "]/input").click()
        # rewardstate为1时为无奖励
        if rewardstate == "1":
            driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").click()
            # 切换iframe
            WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
            driver.switch_to.frame(WebElementframe)
            driver.find_element_by_id("dpTodayInput").click()
            driver.switch_to.default_content()
        # rewardstate为2时为有奖励
        if rewardstate == "2":
            driver.find_element_by_xpath(".//*[@id='status_type']/aside/label[" + rewardmode + "]/input").click()
            # rewardmode为1时为现金奖励
            if rewardmode == "1":
                driver.find_element_by_xpath(".//*[@id='status_1']/aside/input").send_keys(reward)
                driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").click()
                # 切换iframe
                WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
                driver.switch_to.frame(WebElementframe)
                driver.find_element_by_id("dpTodayInput").click()
                driver.switch_to.default_content()
            # rewardmode为2时为按投资金额比例奖励
            if rewardmode == "2":
                driver.find_element_by_xpath(".//*[@id='status_2']/aside/input").send_keys(reward)
                driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").click()
                # 切换iframe
                WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
                driver.switch_to.frame(WebElementframe)
                driver.find_element_by_id("dpTodayInput").click()
                driver.switch_to.default_content()
        driver.find_element_by_xpath(".//*[@id='house']/li[12]/aside/span[1]/a").click()
        #判断是否发布标的成功
        #进入标的批次号管理页面查看是否发布成功
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[11]/a").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
        try:
            driver.find_element_by_xpath(".//*[@id='yfm']")
            b = True
        except:
            b = False
        if b == True:
            text = driver.find_element_by_xpath(".//*[@id='yfm']").text
            borrowid = driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[2]").text
            driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr[1]/td[1]/input").click()  # 勾选第一个标的进行生成批次号
            driver.find_element_by_xpath("html/body/main/section/div[2]/a").click()
            time.sleep(2)
            driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[4]/input[1]").click()
            time.sleep(2)
            driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[3]/input[2]").click()
            # 再次搜索对应用户名的标
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
            driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]/input").click()
            driver.find_element_by_xpath("html/body/main/section/div[2]/a[2]").click()
            time.sleep(2)
            driver.find_element_by_xpath(u"(//input[@value='确定'])[2]").click()
            time.sleep(2)
            driver.refresh()
            # 进入标的初审页面,并按照借款编号进行搜索标的
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            # 进入初审页面
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/textarea").send_keys(u"审核审核")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/span[1]/a").click()
            time.sleep(3)
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            # 提交二审
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr[1]/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='house']/li[12]/aside/span[1]/a").click()
            time.sleep(3)
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/textarea").send_keys(u"审核审核")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/span[1]/a").click()
            # 执行发标连接，进入投资中的借款
            driver.get("http://task.yidaip2p.net/worthautoissue.task.php")
            driver.refresh()
            driver.quit()
            return u"借款标题是：" + borrowtitle + now + u",借款人是：" + borrowname  + u"，借款编号是：" + borrowid
        if b == False:
            driver.quit()
            return u"发标失败"
    if a == False:
        driver.quit()
        return u"登录失败"


#发房易贷
def op_fang(adminname, password, borrowtitle, money, huankuanfangshi, rate, username_type, borrowname, month, cashgroup, agentname, rewardstate, rewardmode, reward):
    # 定义浏览器及地址
    reload(sys)
    sys.setdefaultencoding('utf-8')
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(8)
    driver.get("http://op.yidaip2p.net/")
    # 进行登录co环境的运营平台
    driver.find_element_by_id("adminname").send_keys(adminname)
    driver.find_element_by_id("password").send_keys(password)
    driver.find_element_by_id("authCode").send_keys(u"123456")
    driver.find_element_by_xpath(".//*[@id='submitFrom']/ul/li[4]/input").click()
    # 判断是否登录成功，并输出至日志登录账号名称
    try:
        driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em")
        a = True
    except:
        a = False
    if a == True:
        username = driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em").text
        driver.find_element_by_xpath(".//*[@id='header']/section[2]/nav/ul/li[8]/a").click()
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[2]/a").click()
        #进入发标的第一个页面
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[1]/aside/label[2]/input").click()
        now = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))  # 标的编号命名格式
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[2]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[3]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[4]/aside/input").send_keys(borrowtitle + now)
        Select(driver.find_element_by_id("username_type")).select_by_visible_text(username_type)
        driver.find_element_by_id("username").send_keys(borrowname)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[5]/h6").click()
        if username_type == u"机构":
            driver.find_element_by_id("weituo_ren").send_keys(u"陈强270496")
            driver.find_element_by_id("wtUpload").send_keys("D:\\photo\\1.jpg")
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label[" + huankuanfangshi + "]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_link_text(u"下一步").click()
            #driver.find_element_by_xpath(".//*[@id='form1']/ul/li[6]/aside/input").send_keys(u"陈强")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            driver.find_element_by_link_text(u"下一步").click()
        if username_type == u"个人":
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label[" + huankuanfangshi + "]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_link_text(u"下一步").click()
            # 第二个页面
            Select(driver.find_element_by_id("edu")).select_by_visible_text(u"本科")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[6]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[7]/aside/input").send_keys(u"四川省南充市")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[8]/aside/input").send_keys(u"四川省成都市青羊区")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            Select(driver.find_element_by_id("province")).select_by_visible_text(u"四川省")
            Select(driver.find_element_by_id("city")).select_by_visible_text(u"成都")
            driver.find_element_by_id("work_info").send_keys(u"工作很好，工资很高")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[3]/li[7]/aside/span[1]/a").click()
        #进入发标第三个页面
        # 切换iframe
        driver.switch_to.frame("iframebox1")
        Select(driver.find_element_by_xpath(".//*[@id='house_type']")).select_by_visible_text(u"商品房")
        driver.find_element_by_xpath(".//*[@id='house']/li[3]/aside/label[1]/input").click()
        driver.find_element_by_xpath(".//*[@id='house']/li[5]/aside/input").send_keys(u"2015-07-25")
        driver.find_element_by_xpath(".//*[@id='house']/li[6]/aside/input").send_keys(u"100")
        driver.find_element_by_xpath(".//*[@id='house']/li[8]/aside/input").send_keys(u"成都市公证处")
        driver.find_element_by_id("house_money").send_keys(u"100")
        driver.find_element_by_id("house_area").send_keys(u"100")
        driver.find_element_by_id("house_address").send_keys(u"成都市天府广场")
        driver.find_element_by_id("house_byuser").send_keys(u"陈强")
        Select(driver.find_element_by_id("house_byuser_type")).select_by_visible_text(u"单独所有")
        driver.find_element_by_xpath(".//*[@id='house']/li[14]/aside/input").send_keys(now)
        driver.switch_to.default_content()
        driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li/aside/input[4]").click()
        # 进入发标第四个页面,并判断是否有奖励标
        driver.find_element_by_xpath(".//*[@id='house']/li[2]/aside/label[" + rewardstate + "]/input").click()
        # rewardstate为1时为无奖励
        if rewardstate == "1":
            driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").click()
            # 切换iframe
            WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
            driver.switch_to.frame(WebElementframe)
            driver.find_element_by_id("dpTodayInput").click()
            driver.switch_to.default_content()
        # rewardstate为2时为有奖励
        if rewardstate == "2":
            driver.find_element_by_xpath(".//*[@id='status_type']/aside/label[" + rewardmode + "]/input").click()
            # rewardmode为1时为现金奖励
            if rewardmode == "1":
                driver.find_element_by_xpath(".//*[@id='status_1']/aside/input").send_keys(reward)
                driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").click()
                # 切换iframe
                WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
                driver.switch_to.frame(WebElementframe)
                driver.find_element_by_id("dpTodayInput").click()
                driver.switch_to.default_content()
            # rewardmode为2时为按投资金额比例奖励
            if rewardmode == "2":
                driver.find_element_by_xpath(".//*[@id='status_2']/aside/input").send_keys(reward)
                driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").click()
                # 切换iframe
                WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
                driver.switch_to.frame(WebElementframe)
                driver.find_element_by_id("dpTodayInput").click()
                driver.switch_to.default_content()
        driver.find_element_by_xpath(".//*[@id='house']/li[12]/aside/span[1]/a").click()
        # 判断是否发布标的成功
        # 进入标的批次号管理页面查看是否发布成功
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[11]/a").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
        try:
            driver.find_element_by_xpath(".//*[@id='yfm']")
            b = True
        except:
            b = False
        if b == True:
            text = driver.find_element_by_xpath(".//*[@id='yfm']").text
            borrowid = driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[2]").text
            driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr[1]/td[1]/input").click()  # 勾选第一个标的进行生成批次号
            driver.find_element_by_xpath("html/body/main/section/div[2]/a").click()
            time.sleep(2)
            driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[4]/input[1]").click()
            time.sleep(2)
            driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[3]/input[2]").click()
            # 再次搜索对应用户名的标
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
            driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]/input").click()
            driver.find_element_by_xpath("html/body/main/section/div[2]/a[2]").click()
            time.sleep(2)
            driver.find_element_by_xpath(u"(//input[@value='确定'])[2]").click()
            time.sleep(2)
            driver.refresh()
            # 进入标的初审页面,并按照借款编号进行搜索标的
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            # 进入初审页面
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/textarea").send_keys(u"审核审核")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/span[1]/a").click()
            time.sleep(3)
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            # 提交二审
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr[1]/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='house']/li[12]/aside/span[1]/a").click()
            time.sleep(3)
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/textarea").send_keys(u"审核审核")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/span[1]/a").click()
            # 执行发标连接，进入投资中的借款
            driver.get("http://task.yidaip2p.net/worthautoissue.task.php")
            driver.quit()
            return u"借款标题是：" + borrowtitle + now + u",借款人是：" + borrowname  + u"，借款编号是：" + borrowid
        if b == False:
            driver.quit()
            return u"发标失败"
    if a == False:
        driver.quit()
        return u"登录失败"

#房加贷
def op_fangjiadai(adminname, password, borrow_type,borrowtitle, money, rate, username_type, borrowname, month, agentname, cashgroup, huankuanfangshi, biaofengpei, jiekuanpassword):
    #op_Fdl(运营平台账号, 运营平台密码, 借款金额, 借款年利率, 借款人, P2P登录账号, P2P登录密码, P2P交易密码, 满标复审日期)
    # 定义浏览器及地址
    reload(sys)
    sys.setdefaultencoding('utf-8')
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(8)
    driver.get("http://op.yidaip2p.net/")
    # 进行登录co环境的运营平台
    driver.find_element_by_id("adminname").send_keys(adminname)
    driver.find_element_by_id("password").send_keys(password)
    driver.find_element_by_id("authCode").send_keys(u"123456")
    driver.find_element_by_xpath(".//*[@id='submitFrom']/ul/li[4]/input").click()
    # 判断是否登录成功，并输出至日志登录账号名称
    try:
        driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em")
        a = True
    except:
        a = False
    if a == True:
        username = driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em").text
        os.chdir('D:\python-photo\log')  # 切换到当前目录
        report = open("OP-login.doc", "a")  # 打开报告
        current_time = datetime.datetime.now()
        report.write("\n%s:" % current_time)
        report.write("开始发标，登录成功,账号昵称是：" + username + "\n")
        driver.find_element_by_xpath(".//*[@id='header']/section[2]/nav/ul/li[8]/a").click()
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[3]/a").click()
        #第一个页面
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[1]/aside/label["+borrow_type+"]/input").click()
        now = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))  # 标的编号命名格式,也为业务编号
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[2]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[3]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[4]/aside/input").send_keys(borrowtitle + now)
        Select(driver.find_element_by_id("username_type")).select_by_visible_text(username_type)
        driver.find_element_by_id("username").send_keys(borrowname)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[5]/h6").click()
        if username_type == u"机构":
            driver.find_element_by_id("weituo_ren").send_keys(u"陈强270496")
            driver.find_element_by_id("wtUpload").send_keys("D:\\photo\\1.jpg")
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label[" + huankuanfangshi + "]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_link_text(u"下一步").click()
            #driver.find_element_by_xpath(".//*[@id='form1']/ul/li[6]/aside/input").send_keys(u"陈强")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            driver.find_element_by_link_text(u"下一步").click()
        if username_type == u"个人":
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label["+ huankuanfangshi +"]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_link_text(u"下一步").click()
            #第二个页面
            Select(driver.find_element_by_id("edu")).select_by_visible_text(u"本科")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[6]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[7]/aside/input").send_keys(u"四川省南充市")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[8]/aside/input").send_keys(u"四川省成都市青羊区")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            Select(driver.find_element_by_id("province")).select_by_visible_text(u"四川省")
            Select(driver.find_element_by_id("city")).select_by_visible_text(u"成都")
            driver.find_element_by_id("work_info").send_keys(u"工作很好，工资很高")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[3]/li[7]/aside/span[1]/a").click()
        # 进入发标第三个页面
        # 切换iframe
        driver.switch_to.frame("iframebox1")
        Select(driver.find_element_by_xpath(".//*[@id='house_type']")).select_by_visible_text(u"商品房")
        driver.find_element_by_xpath(".//*[@id='house']/li[3]/aside/label[1]/input").click()
        driver.find_element_by_xpath(".//*[@id='house']/li[4]/aside/input").send_keys(u"2005-07-25")
        driver.find_element_by_xpath(".//*[@id='house']/li[5]/aside/input").send_keys(u"2015-07-25")
        driver.find_element_by_xpath(".//*[@id='house']/li[6]/aside/input").send_keys(u"100")
        driver.find_element_by_xpath(".//*[@id='house']/li[7]/aside/input").send_keys(u"成都市青羊区宽窄巷子")
        driver.find_element_by_xpath(".//*[@id='house']/li[8]/aside/input").send_keys(u"成都市公证处")
        driver.find_element_by_id("house_money").send_keys(u"100")
        driver.find_element_by_id("house_area").send_keys(u"100")
        driver.find_element_by_id("house_address").send_keys(u"成都市天府广场" + now)
        driver.find_element_by_id("house_byuser").send_keys(u"陈强")
        Select(driver.find_element_by_id("house_byuser_type")).select_by_visible_text(u"单独所有")
        driver.find_element_by_xpath(".//*[@id='house']/li[14]/aside/input").send_keys(now)
        driver.switch_to.default_content()
        driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li/aside/input[4]").click()
        # 进入发标第四个页面
        #选择标的分配
        driver.find_element_by_xpath(".//*[@id='house']/li[1]/aside/label[" + biaofengpei + "]/input").click()
        driver.find_element_by_xpath(".//*[@id='house']/li[4]/aside/input").click()
        # 切换iframe
        WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
        driver.switch_to.frame(WebElementframe)
        driver.find_element_by_id("dpTodayInput").click()
        driver.switch_to.default_content()
        #driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").send_keys(u"2017-09-05 10:40")
        #截图并保存
        #pic_path = 'D:\\python-photo\\image\\' + now + 'FDL-biao' + '.png'  # 截图保存路径
        #print pic_path
        #driver.save_screenshot(pic_path)  # 截图
        driver.find_element_by_xpath(".//*[@id='house']/li[7]/aside/span[1]/a").click()
        #生成批次号
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[11]/a").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
        driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]/input").click()
        driver.find_element_by_xpath("html/body/main/section/div[2]/a").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[4]/input[1]").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[3]/input[2]").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
        driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]/input").click()
        driver.find_element_by_xpath("html/body/main/section/div[2]/a[2]").click()
        time.sleep(2)
        driver.find_element_by_xpath(u"(//input[@value='确定'])[2]").click()
        driver.refresh()
        # 判断是否发布标的成功
        #根据业务编号进行搜索标，并进行审核
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
        #判断是否发布成功
        try:
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]")
            b = True
        except:
            b = False
        if b == True:
            borrowid = driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]").text
            print u"借款编号是：" + borrowid
            #进行第一次审核
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/textarea").send_keys(u"审核成功")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/aside/span[1]/a").click()
            #按照业务编号进行搜索标
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            #进行第二次审核
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_id("borrow_password").send_keys(jiekuanpassword)
            driver.find_element_by_xpath(".//*[@id='house']/li[8]/aside/span[1]/a").click()
            # 按照业务编号进行搜索标
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            #进行第三次审核
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/textarea").send_keys(u"审核成功")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/aside/span[1]/a").click()
            #初审完毕，执行发标计划任务，进入投资中的借款
            driver.get("http://task.yidaip2p.net/worthautoissue.task.php")
            driver.quit()
            return u"借款标题是：" + borrowtitle + now + u",借款人是：" + borrowname  + u"，借款编号是：" + borrowid
        if b == False:
            return u"发布失败！"


def op_fangjiadaireview(adminname, password, borrowtitle, money, rate, username_type, borrowname, month, agentname, cashgroup, huankuanfangshi, biaofengpei, jiekuanpassword, date):
    #op_Fdl(运营平台账号, 运营平台密码, 借款金额, 借款年利率, 借款人, P2P登录账号, P2P登录密码, P2P交易密码, 满标复审日期)
    # 定义浏览器及地址
    reload(sys)
    sys.setdefaultencoding('utf-8')
    driver = webdriver.Chrome()
    driver.maximize_window()
    driver.implicitly_wait(8)
    driver.get("http://op.yidaip2p.net/")
    # 进行登录co环境的运营平台
    driver.find_element_by_id("adminname").send_keys(adminname)
    driver.find_element_by_id("password").send_keys(password)
    driver.find_element_by_id("authCode").send_keys(u"123456")
    driver.find_element_by_xpath(".//*[@id='submitFrom']/ul/li[4]/input").click()
    # 判断是否登录成功，并输出至日志登录账号名称
    try:
        driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em")
        a = True
    except:
        a = False
    if a == True:
        username = driver.find_element_by_xpath(".//*[@id='header']/section[1]/div/aside/em").text
        os.chdir('D:\python-photo\log')  # 切换到当前目录
        report = open("OP-login.doc", "a")  # 打开报告
        current_time = datetime.datetime.now()
        report.write("\n%s:" % current_time)
        report.write("开始发标，登录成功,账号昵称是：" + username + "\n")
        driver.find_element_by_xpath(".//*[@id='header']/section[2]/nav/ul/li[8]/a").click()
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[3]/a").click()
        #第一个页面
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[1]/aside/label[6]/input").click()
        now = time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))  # 标的编号命名格式,也为业务编号
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[2]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[3]/aside/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[4]/aside/input").send_keys(borrowtitle + now)
        Select(driver.find_element_by_id("username_type")).select_by_visible_text(username_type)
        driver.find_element_by_id("username").send_keys(borrowname)
        driver.find_element_by_xpath(".//*[@id='form1']/ul[1]/li[5]/h6").click()
        if username_type == u"机构":
            driver.find_element_by_id("weituo_ren").send_keys(u"陈强270496")
            driver.find_element_by_id("wtUpload").send_keys("D:\\photo\\1.jpg")
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label[" + huankuanfangshi + "]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_xpath(".//*[@id='form1']/ul[3]/li[4]/aside/a").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[6]/aside/input").send_keys(u"陈强")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[10]/aside/span[1]/a").click()
        if username_type == u"个人":
            Select(driver.find_element_by_id("borrow_use")).select_by_visible_text(u"临时周转")
            driver.find_element_by_id("account").send_keys(money)
            driver.find_element_by_xpath(".//*[@id='borrow_style_box']/label["+ huankuanfangshi +"]/input").click()
            Select(driver.find_element_by_id("borrow_period")).select_by_visible_text(month)
            time.sleep(2)
            driver.find_element_by_id("borrow_apr").clear()
            driver.find_element_by_id("borrow_apr").send_keys(rate)
            Select(driver.find_element_by_xpath(".//*[@id='cashgroup']")).select_by_visible_text(cashgroup)
            driver.find_element_by_id("agent_username").send_keys(agentname)
            driver.find_element_by_xpath(".//*[@id='form1']/ul[3]/li[4]/aside/a").click()
            #第二个页面
            Select(driver.find_element_by_id("edu")).select_by_visible_text(u"本科")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[6]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[7]/aside/input").send_keys(u"四川省南充市")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li[8]/aside/input").send_keys(u"四川省成都市青羊区")
            driver.find_element_by_id("account_use").send_keys(u"借钱来耍耍")
            Select(driver.find_element_by_id("province")).select_by_visible_text(u"四川省")
            Select(driver.find_element_by_id("city")).select_by_visible_text(u"成都")
            driver.find_element_by_id("work_info").send_keys(u"工作很好，工资很高")
            driver.find_element_by_xpath(".//*[@id='form1']/ul[3]/li[7]/aside/span[1]/a").click()
        # 进入发标第三个页面
        # 切换iframe
        driver.switch_to.frame("iframebox1")
        Select(driver.find_element_by_xpath(".//*[@id='house_type']")).select_by_visible_text(u"商品房")
        driver.find_element_by_xpath(".//*[@id='house']/li[3]/aside/label[1]/input").click()
        driver.find_element_by_xpath(".//*[@id='house']/li[4]/aside/input").send_keys(u"2005-07-25")
        driver.find_element_by_xpath(".//*[@id='house']/li[5]/aside/input").send_keys(u"2015-07-25")
        driver.find_element_by_xpath(".//*[@id='house']/li[6]/aside/input").send_keys(u"100")
        driver.find_element_by_xpath(".//*[@id='house']/li[7]/aside/input").send_keys(u"成都市青羊区宽窄巷子")
        driver.find_element_by_xpath(".//*[@id='house']/li[8]/aside/input").send_keys(u"成都市公证处")
        driver.find_element_by_id("house_money").send_keys(u"100")
        driver.find_element_by_id("house_area").send_keys(u"100")
        driver.find_element_by_id("house_address").send_keys(u"成都市天府广场" + now)
        driver.find_element_by_id("house_byuser").send_keys(u"陈强")
        Select(driver.find_element_by_id("house_byuser_type")).select_by_visible_text(u"单独所有")
        driver.find_element_by_xpath(".//*[@id='house']/li[14]/aside/input").send_keys(now)
        driver.switch_to.default_content()
        driver.find_element_by_xpath(".//*[@id='form1']/ul[2]/li/aside/input[4]").click()
        # 进入发标第四个页面
        #选择标的分配
        driver.find_element_by_xpath(".//*[@id='house']/li[1]/aside/label[" + biaofengpei + "]/input").click()
        driver.find_element_by_xpath(".//*[@id='house']/li[4]/aside/input").click()
        # 切换iframe
        WebElementframe = driver.find_element_by_xpath("html/body/div/iframe")
        driver.switch_to.frame(WebElementframe)
        driver.find_element_by_id("dpTodayInput").click()
        driver.switch_to.default_content()
        #driver.find_element_by_xpath(".//*[@id='house']/li[9]/aside/input").send_keys(u"2017-09-05 10:40")
        #截图并保存
        #pic_path = 'D:\\python-photo\\image\\' + now + 'FDL-biao' + '.png'  # 截图保存路径
        #print pic_path
        #driver.save_screenshot(pic_path)  # 截图
        driver.find_element_by_xpath(".//*[@id='house']/li[7]/aside/span[1]/a").click()
        #生成批次号
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[11]/a").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
        driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]/input").click()
        driver.find_element_by_xpath("html/body/main/section/div[2]/a").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[4]/input[1]").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='form_yhk']/ul/li[3]/input[2]").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/a").click()
        driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]/input").click()
        driver.find_element_by_xpath("html/body/main/section/div[2]/a[2]").click()
        time.sleep(2)
        driver.find_element_by_xpath(u"(//input[@value='确定'])[2]").click()
        driver.refresh()
        # 判断是否发布标的成功
        #根据业务编号进行搜索标，并进行审核
        driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
        Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"业务编号")
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(now)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
        #判断是否发布成功
        try:
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]")
            b = True
        except:
            b = False
        if b == True:
            borrowid = driver.find_element_by_xpath(".//*[@id='tabScroll']/div/table/tbody/tr/td[1]").text
            print u"借款编号是：" + borrowid
            #进行第一次审核
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/textarea").send_keys(u"审核成功")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/aside/span[1]/a").click()
            #按照业务编号进行搜索标
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            #进行第二次审核
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_id("borrow_password").send_keys(jiekuanpassword)
            driver.find_element_by_xpath(".//*[@id='house']/li[8]/aside/span[1]/a").click()
            # 按照业务编号进行搜索标
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[4]/a").click()
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/a").click()
            #进行第三次审核
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[2]/aside/label[1]/input").click()
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/aside/textarea").send_keys(u"审核成功")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[4]/aside/span[1]/a").click()
            #初审完毕，执行发标计划任务，进入投资中的借款
            driver.get("http://task.yidaip2p.net/worthautoissue.task.php")
            driver.get("http://op.yidaip2p.net/")
            #再次登录运营平台
            driver.find_element_by_id("adminname").send_keys(adminname)
            driver.find_element_by_id("password").send_keys(password)
            driver.find_element_by_id("authCode").send_keys(u"123456")
            driver.find_element_by_xpath(".//*[@id='submitFrom']/ul/li[4]/input").click()
            driver.find_element_by_xpath(".//*[@id='header']/section[2]/nav/ul/li[8]/a").click()
            driver.find_element_by_xpath(".//*[@id='subnav']/dl/dd[5]/a").click()
            # 按照业务编号进行搜索标
            Select(driver.find_element_by_id("searchType")).select_by_visible_text(u"借款编号")
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[1]/input[2]").send_keys(borrowid)
            driver.find_element_by_xpath(".//*[@id='form1']/ul/li[3]/a").click()
            driver.find_element_by_xpath(".//*[@id='tabScroll']/table/tbody/tr/td/a[1]").click()
            driver.find_element_by_xpath(".//*[@id='checkCDY']").click()
            driver.find_element_by_xpath(".//*[@id='remark']/aside/textarea").send_keys(u"审核成功")
            driver.find_element_by_xpath(".//*[@id='resub']/aside/span[1]/a").click()
            # 执行满标复审的连接
            driver.get("http://api.yidaip2p.net/apitest/test/?borrowId=" + borrowid + "&issueDay=" + date)
            message = driver.find_element_by_xpath("html/body").text
            print message
            driver.quit()
            return u"借款标题是：" + borrowtitle + now + u",借款人是：" + borrowname  + u"，借款编号是：" + borrowid + message
        if b == False:
            return u"发布失败！"